package com.sany.activity.controller;

import com.sany.activity.pojo.LeaveBill;
import com.sany.activity.service.LeaveBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/leaveBill")
public class LeaveBillController {
    @Autowired
    private LeaveBillService leaveBillService;

    @GetMapping("/getAll")
    public List<LeaveBill> getAllLeaveBill(@RequestParam("id")Long id){
       return leaveBillService.getAll(id);
    }

    @PostMapping("/add")
    public boolean addLeaveBill(@RequestBody LeaveBill leaveBill){
      return   leaveBillService.addLeaveBill(leaveBill);
    }

    @DeleteMapping("/delete")
    public boolean deleteLeaveBill(@RequestParam("id")Long id){
        return leaveBillService.deleteLeaveBill(id);
    }
    @PostMapping("/update")
    public boolean updateLeaveBill(@RequestBody LeaveBill leaveBill){
        return leaveBillService.updateLeaveBill(leaveBill);
    }
}
